package shiro.com.controller.sys;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import shiro.com.basie.domain.AjaxResult;
import shiro.com.domain.TableDataInfo;
import shiro.com.domain.sys.vo.SysComontTreeVo;
import shiro.com.service.sys.ISysComontService;
import shiro.com.basie.controller.BaseController;
import shiro.com.domain.sys.SysComont;

import static shiro.com.basie.domain.AjaxResult.success;

/**
 * 【请填写功能名称】Controller
 *
 * @author ruoyi
 * @date 2022-11-21
 */

@RestController
@CrossOrigin
@RequestMapping("/system/comont")
public class SysComontController extends BaseController
{
    @Autowired
    private ISysComontService sysComontService;

    /**
     * 查询【请填写功能名称】列表
     */


    @GetMapping("/list")
   // @RequiresPermissions("user:batchDelete")
    public TableDataInfo list(SysComont sysComont)
    {
        List<SysComont> list = sysComontService.selectSysComontList(sysComont);
        return getDataTable(list);
    }

    @GetMapping("/tree")
    public TableDataInfo tree()
    {
        List<SysComontTreeVo> list = sysComontService.selectTreeList();
        return getDataTable(list);
    }
//
//    /**
//     * 导出【请填写功能名称】列表
//     */
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, SysComont sysComont)
//    {
//        List<SysComont> list = sysComontService.selectSysComontList(sysComont);
//        ExcelUtil<SysComont> util = new ExcelUtil<SysComont>(SysComont.class);
//        util.exportExcel(response, list, "【请填写功能名称】数据");
//    }
//
    /**
     * 获取【请填写功能名称】详细信息
     */
    @GetMapping(value = "/{sysComontId}")
    public AjaxResult getInfo(@PathVariable("sysComontId") Integer sysComontId)
    {
        return success(sysComontService.selectSysComontBySysComontId(sysComontId));
    }
    @PostMapping("/nameId")
    public AjaxResult selectName(@Param("phone") String phone)
    {

       return success(sysComontService.selectNameByPhone(phone));
    }
//
//    /**
//     * 新增【请填写功能名称】
//     */
//    @PostMapping
//    public AjaxResult add(@RequestBody SysComont sysComont)
//    {
//        return toAjax(sysComontService.insertSysComont(sysComont));
//    }
//
//    /**
//     * 修改【请填写功能名称】
//     */
//    @PreAuthorize("@ss.hasPermi('system:comont:edit')")
//    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PostMapping
    public AjaxResult edit(SysComont sysComont)
    {

        return toAjax(sysComontService.updateSysComont(sysComont));
    }
//
//    /**
//     * 删除【请填写功能名称】
//     */
//    @PreAuthorize("@ss.hasPermi('system:comont:remove')")
//    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{sysComontIds}")
    public AjaxResult remove(@PathVariable Integer[] sysComontIds)
    {


        return toAjax(sysComontService.deleteSysComontBySysComontIds(sysComontIds));
    }

}
